'use strict';

const { get } = require("lodash");

function compute_median(numbers) {
  //在这里写入代码
  var res ;
  var length = numbers.length;
  if(length === 1 ){
    return numbers[0];
  }
  if(length%2 ===1){
    res = numbers[parseInt(length/2)]
  }else{
    res  =(numbers[length /2 -1] + numbers[length /2])/2
  }
  return res;

}
function compute_median(collection){
  collection.sort((a,b) => a - b)
  return getMedian(collection);
}

module.exports = compute_median;


